package org.springblade.modules.admin.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;

import org.springblade.core.tool.api.R;
import org.springblade.modules.admin.dto.UserSchedulingConfigAddDTO;
import org.springframework.web.bind.annotation.*;
import org.springblade.modules.admin.vo.UserSchedulingConfigVO;
import org.springblade.modules.admin.service.IUserSchedulingConfigService;
import org.springblade.core.boot.ctrl.BladeController;


/**
 * 人员维保排期关注配置 控制器
 *
 * @author Sharry
 * @since 2023-12-14
 */
@RestController
@AllArgsConstructor
@RequestMapping("user/scheduling/config")
@Api(value = "人员维保排期关注配置", tags = "人员维保排期关注配置接口")
public class UserSchedulingConfigController extends BladeController {

	private final IUserSchedulingConfigService userSchedulingConfigService;

	/**
	 * 新增或修改 人员维保排期关注配置
	 */
	@PostMapping("/submit")
	@ApiOperationSupport(order = 10)
	@ApiOperation(value = "新增或修改", notes = "传入userSchedulingConfig")
	public R<Boolean> saveOrUpdateConfig(@RequestBody UserSchedulingConfigAddDTO userSchedulingConfig) {
		Boolean result = userSchedulingConfigService.saveOrUpdateConfig(userSchedulingConfig);
		return R.data(result);
	}

	/**
	 * 人员维保排期关注配置相关列表
	 */
	@GetMapping("/list/all/by/plan/status")
	@ApiOperationSupport(order = 30)
	@ApiOperation(value = "关注日日程选择列表", notes = "传入userSchedulingConfig")
	public R<UserSchedulingConfigVO> listByPlanStatus(Integer status) {
		UserSchedulingConfigVO result = userSchedulingConfigService.listAll(status);
		return R.data(result);
	}

	/**
	 * 人员维保排期关注配置相关列表
	 */
	@GetMapping("/list/config")
	@ApiOperationSupport(order = 30)
	@ApiOperation(value = "获取用户配置", notes = "传入userSchedulingConfig")
	public R<UserSchedulingConfigVO> listExisted() {
		UserSchedulingConfigVO result = userSchedulingConfigService.listConfig();
		return R.data(result);
	}



}
